Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: A simple musical Notes player  (Read 5201 times)

0 Members and 1 Guest are viewing this topic.

amhndu

  • Newbie
  • *
  • Posts: 42
  • Err, err and err again, but less, less and less
    • View Profile
    • amhndu.github.io
    • Email
A simple musical Notes player
« on: July 01, 2016, 10:08:18 am »
Notes
Notes is a simple graphical musical notes player. Within the window use the keyboard to play. The numeric row and alphabetical rows are used.Using each row is equivalent, thus 1, Q, A and Z all play the same note. The notes get higher from left to right

Github link
https://github.com/amhndu/Notes

Command line options:

Usage ./notes [OPTIONS]
--help, -h                        Display this text and exit
--note-duration, -d <duration>    Set the note duration in milliseconds
                                  (default: 300)
--sample-rate, -r <rate>          Set the sample in samples per second, higher
                                  means higher quality but also higher load time
                                  (default: 441000)
--namednotesinput, -n             Input/play notes by their names instead.
                                  Available notes: C D E F G A B
                                  Don't use this option if you want more notes
                                  or the positional input (the default)

Compiling
Dependencies

SFML 2+
Build system: cmake 3.1+

On Linux/OS X:

cd Notes                        #Go the the project directory
mkdir build/ && cd build/
cmake -DCMAKE_BUILD_TYPE=Release .. && make
./notes                         #Launch
Similar steps for Windows.

Songs
Try these tunes!

Twinkle Twinkle
 
QQTTYYT RREEWWQ TTRREEW TTRREEW QQTTYYT RREEWWQ

Happy Birthday
 
1-1-2-1-4-3- -1-1-2-1-5-4- -1-1-8-6-4-3-2- -8-8-7-4-5-4

Harry Potter theme
 
E-Y-I-U-Y-P-O-U-Y-I-U-Y-U-E

Mary had a little lamb
In named input method, launch with -n (./notes -n)
 
EDCDEEE DDDEEE EDCDEEE EDDEDC

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: A simple musical Notes player
« Reply #1 on: July 01, 2016, 12:55:06 pm »
Cool! :)

Can you create some binaries and add them as release on GitHub?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

amhndu

  • Newbie
  • *
  • Posts: 42
  • Err, err and err again, but less, less and less
    • View Profile
    • amhndu.github.io
    • Email
Re: A simple musical Notes player
« Reply #2 on: July 01, 2016, 01:27:14 pm »
On what platform are you suggesting ? I can only make binaries for Linux, should I make it static ?
As my thinking goes, different distributions might be incompatible.
For other platforms, I'll probably ask a friend with Mac and another with Windows for help.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: A simple musical Notes player
« Reply #3 on: July 01, 2016, 01:31:22 pm »
Ah okay. Yeah for Linux it's always a bit tricky. Guess I'll build it myself then. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: A simple musical Notes player
« Reply #4 on: July 01, 2016, 05:26:43 pm »
Modified your CMakeLists.txt a bit to properly include include directories and SFML dependencies:

cmake_minimum_required(VERSION 3.1)
project(notes)

find_package(SFML 2 COMPONENTS graphics window audio system REQUIRED)

if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
        set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -g")
        set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
endif()

file(GLOB SOURCES
    "${PROJECT_SOURCE_DIR}/*.cpp"
)

include_directories(${SFML_INCLUDE_DIR})
add_executable(notes ${SOURCES})
target_link_libraries(notes ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})

set_property(TARGET notes PROPERTY CXX_STANDARD 11)
set_property(TARGET notes PROPERTY CXX_STANDARD_REQUIRED ON)

install(TARGETS notes RUNTIME DESTINATION bin)
 

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: A simple musical Notes player
« Reply #5 on: July 01, 2016, 07:15:04 pm »
Good to see people actually interested in musical things with SFML  :D

I once made a virtual keyboard too (I use it in a music editor that I'm casually working on). I would suggest that you also include sharp/flat notes. I mean, they're needed for that Harry Potter theme! :P

The keyboard is layed out rather nicely to place them on alternate rows. For example:
23 567 90 = (C# D# F# G# A# C# D# F#)
QWERTYUIOP[] (CDEFGABCDEFG)
SD GHJ L; (C# D# F# G# A# C# D#)
ZXCVBNM,./ (CDEFGABCDE)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

amhndu

  • Newbie
  • *
  • Posts: 42
  • Err, err and err again, but less, less and less
    • View Profile
    • amhndu.github.io
    • Email
Re: A simple musical Notes player
« Reply #6 on: July 02, 2016, 06:07:44 am »
@Mario
Thanks, I forgot about the headers!
I installed SFML under /usr/ so I didn't need to mention the header location for my system


Good to see people actually interested in musical things with SFML  :D

I once made a virtual keyboard too (I use it in a music editor that I'm casually working on). I would suggest that you also include sharp/flat notes. I mean, they're needed for that Harry Potter theme! :P

The keyboard is layed out rather nicely to place them on alternate rows. For example:
23 567 90 = (C# D# F# G# A# C# D# F#)
QWERTYUIOP[] (CDEFGABCDEFG)
SD GHJ L; (C# D# F# G# A# C# D#)
ZXCVBNM,./ (CDEFGABCDE)


Good idea, I'll probably implement them too

 

anything