开发者

Changing the frequency of a sound thats currently being played (Android)

I am trying to build an Android App, that plays a guitar sound when one tap at the screen. As more as you swipe your finger to the right side of the display, 开发者_运维问答as more should the frequence of the tone getting higher. For example: I tap on the left side of the screen and hear a normal guitar tone (let's say the note "G"). Now if you swipe your finger to the right, it shouldn't play the sound again, but the current sound that is beeing played should turn higher (like the note "D") Hope it's clear what I want. Like a virtual instrument with some kind of "vibro effect".

Anybody knows how to implement this?

Thx Chriz


Normally this kind of thing is done with a waveform lookup table, and then you just iterate through the table at whatever rate you need to get the required output frequency. The key point is that you use a fixed point table index so that you can specify an accurate delta for each sample - you use the integer part to get the table indices and then optionally interpolate between adjacent samples using the fractional part of the index. If you choose a table size which is 2^N then the modulo wraparound at the end of the table is very easy to handle.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜