0

My project is to create a kit to play recorded (music chords) audio file automatically changed with respect to frequency of live microphone input with a certain period.This will help the solo singers in backing them with chords.i have the concept but i don't have the coding knowledge that much. i will have many sets(folders of different music scales containing chord samples of particular scale as specified by music scale chart)of recorded audio files stored in the memory card or pen drive.the set should be selected by the user(which scale).the audio file should be changed with time that is driven by a tap tempo code as like shown below .the resulting tempo should be divided by 2,3 or 4 according to the time signature of the song the singer sings and should be used to change the audio file. the model code for tap tempo is available on https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=62836

this is a code which i got from a blog for the tap tempo metronome.here the code will find the tempo and will be used for the pwm generation frequency.but the same can be used for knowing the tempo and divided with time signature and used as period to change the audio file .the audio files are selected by the table specified in http://pages.mtu.edu/~suits/notefreqs.html the audio files should be selected by matching the frequency input of mic and music note and name of file in the set(folder containing chord audio files of particular scale) specified. the audio file should be played continuously without any latency in reading the file as it is a real time project.

things i have : recorded audio files named as same as in frequency:music note table - seperated as sets or folders for different music scales gpio input for tap tempo push button 3.5mm pin microphone

things required to ask user while running: scale(which set of audio files) tap (to find time period) time signature(figure to be devided from tempo to know the time period)

i need suggestions on: type of audio file format that can be used to store the samples code to execute the concept interfacing mic to raspberry pi can the process be done with minimum latency

guys this will help lots of singers in solo singing who does not have any instruments .kindly help me with the code if you can . thanks in advance for people trying to help me.

2
  • scale charthttp://www.piano-keyboard-guide.com/piano-music-scales.html
    – dani
    Commented Aug 16, 2017 at 16:33
  • frequency-music note table pages.mtu.edu/~suits/notefreqs.html
    – dani
    Commented Aug 16, 2017 at 16:34

1 Answer 1

1

There is a coding tutorial here which demonstrates a full duplex client for jackd. Full duplex means recording in and playing out at the same time.

By using a full duplex client, you can process the input and output as required. There are also links there for suitable cards with inbuilt microphones.

The lowest latency you can probably get is around 1ms in and out (say 50 samples at 48 kHz). You will probably want to target around 3ms latency before the performer starts to feel uncomfortable with latency ... but you can probably push that a little.

That set of audio programming tutorials also demonstrate how to open, read and write almost any type of audio file. The base library used is SoX which has the capability to load and save many different audio formats. For that reason you can pretty much pick and choose any audio format you like. If you want lossless audio, then something like wav, flac or other will do.

To bring your processing needs down, as you are using voice, work out the upper frequency which are in your files and drop the sample rate to double that frequency. For example, if there isn't much audio data above 12 kHz, you can drop your sample rate to 24 kHz and save a huge amount on processing requirements. Consider that the first formant of singing is probably between 2kHz and 200 Hz, which means that the third formant may not be much above 8 kHz. Because you are talking about vocalised sounds, you aren't too concerned with consonants and consequently the high frequencies are not going to be present. It may be different for your recorded instruments.

If you can push your sample rate down, then you can probably get better latencies.

Do you have enough memory to load an entire set of chords into memory ? If so then extra delays/computation in file loading and waiting can be removed.

5
  • hello brother ,is there any possibilities to code with python as i am a beginner with it and it would be comfortable for me .
    – dani
    Commented Aug 19, 2017 at 15:29
  • if using the same full duplex thing with c language can i use the usb mic.reading and analyzing different audio in the input and playing different audio in the output
    – dani
    Commented Aug 19, 2017 at 15:56
  • Yes - you can. Similar libraries are available for python if you prefer to use that language.
    – Matt
    Commented Aug 20, 2017 at 13:30
  • thank u then please suggest me some websites which contains the tutorials which suits my need
    – dani
    Commented Aug 20, 2017 at 14:36
  • please sugest me with libraries which i should use for frequency recognition from microphone
    – dani
    Commented Aug 27, 2017 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.