I need the change the voice modulation of an audio file, tried whole day with SoundPool but it only changes the playing speed of audio. I want to change the modulation. Need your suggestion, Thanks in advance.
See the accepted answer for Python Audio Frame Pitch Change for a brief explanation of what you need to do. For Java libraries that lets you do FFT / inverse FFT, see e.g. FFTW (I haven't used it myself, so I can't provide any help with that part).
Related
I am just trying to be in the middle of the playing service of sound in Android.
I have an algorithm in C language that I coded myself that improves the audio quality.
It calculates the middle point between two values increasing the sample rate. It's easy.
By this way I am able to reproduce any audio CD quality with best results. But I want to listen to Spotify on my phone. In my computer I know coding and maybe being in the middle of the pulseaudio service I can change the raw userdata on the fly but I have no stereo and I need to do it on my phone because, also the neighbors you know, it's 4 am and I don't think they like psytrance if on Monday.
I am able to modify any song offline but nothing in comparison with the power of streaming because it's playing all the music I like without investing more time.
The source code is available at http://abelromero.com/proyectos/C/musica/algoritmo-que-mejora-la-musica.html which is the post where I explain it but it's in Spanish so... please if you like to know, use a translator.
http://abelromero.com/proyectos/C/musica/music4.c
http://abelromero.com/proyectos/C/musica/music5.c
Thanks in advance!
I am just developing a sample app in unity (as a beginner) so i am stuck at a point, i need to change the sound which is recorded (like in Talking Tom app).
i am done with recording the audio but when i increase the pitch of the sound the speed of the playback is also changed. i need the playback speed is normal only pitch must be changed.
so can anyone help me on this issue.
Thanks in advance
After a bit of researching, I found that what you're trying to do is called "pitch shifting". It involves a lot of math and mucking about with sound packets apparently because changing the pitch of a sound, automatically changes it's playback speed. Getting it back to the speed you want while still keeping the audio at something considered "normal" is no walk in the park.
In any case, since Unity3D uses C#, you might (and I stress the word might) be able to use this open source library to get the sound effect you need. It's based on NAudio (also open source, and C#) so you should theoretically be able to use it, or parts of it in your project.
I am developing a sound related application. I am trying to change the audio sound in to completely different like robot sound or make the audio echo. I tried with soundpool , but no any idea, anyone knows how to achieve that? i need only a basic idea to achieve this, please help. many thanks.
Pitch and echo are 2 different things.
Pitch:
You can alter the pitch by modifing the playback rate. You can do it in 2 ways, with audioTrack and setPlayBackRate or with SoundPool and setRate. Depends on your needs, AudioTrack allow a larger range of pitch (from 1hz to x2) on large files and SoundPool for sound effects and picth can vary between x0.5 and x2.
Echo/reverb:
You can archive this with AudioEffect since API lvl 9 by attaching it to an AudioTrack or MediaPlayer instance.
For a robot effect you want to set a constant pitch for the audio. I.e. do a FFT, move everything into a single frequency bin, and then do an inverse FFT to get back into the time domain.
For an echo effect you could keep a separate buffer which is as long as your desired echo delay. And for every sample do something like the following (pseudo-code):
output = mix(currentSample, echoBuffer[echoPos]*echoVolume)
echoBuffer[echoPos] = mix(currentSample, echoBuffer[echoPos]*echofeedback)
echoPos += 1
Im working on a similar project and i can say that you need to look into DSP (digital signal processing), PCM 16 format and preferably fourier transforms.
It is possible to loopback audio with the AudioRecord class (running a thread constantly filling the buffer on a AudioTrack)
But the delay might be too big for what you are trying to accomplish.
Best of luck in your endevours!
Some really good pointers:
Android AudioRecord class - process live mic audio quickly, set up callback function
I want to develop a bass effect for media player.Can any body help me regarding this..
First step is to isolate the low-frequency components. You will need an FFT to do this... there's one linked to this older S/O question.
After you've got the frequency representation of your audio data, alter the magnitudes of the low-frequency components as you see it, run the inverse transform to convert it back to audio samples, and pass it to the audio hardware for playback.
is there a way to filter audio in android system?
I am interested to get only the audio of a fixed frequency.
If you get your audio via the AudioRecord class, then you'll have raw audio data that you could filter using whatever audio filter algorithm you have. Or are you looking for an audio filtering library?
As Dave says, the AudioRecord class is the easiest way. Often times, I will extend an AsyncTask that implements AudioRecord to read the audio buffer and push the buffer back to the UI thread for visualization (if needed).
Regarding the filtering of the audio, Android does not provide any built-in way of doing this. The way you would filter out certain frequencies is by taking the Fourier Transform of the sampled audio and then pulling out the frequencies of interest.
If you want more details on filtering, you should probably post a new SO question or wiki the Fast Fourier Transform (FFT). You might also look into JTransforms which is a great open source FFT library that runs wonderfully on Android.
Please do NOT use the FFT for this. That's amateur hour. (The FFT is a great tool with many great use-cases, but this is not one of them.) You most likely want to solve this problem using time domain filters. Here's a post to get you started writing your own filters in the time domain as easy as can be. However, a lot of people stumble on that since it's a bit specialized, so if you want to use something built-in to android, start with the equalizer audio effect.