ArduinoProgrammableSoundGenerator
所属分类:虚拟/增强现实-VR/AR
开发工具:C
文件大小:19KB
下载次数:0
上传日期:2018-01-31 13:19:40
上 传 者:
sh-1993
说明: Arduino多声道音调发生器
(An Arduino multichannel tone generator)
文件列表:
APSG.cpp (6385, 2018-01-31)
APSG.h (2027, 2018-01-31)
ArduinoProgrammableSoundGenerator.ino (3241, 2018-01-31)
melodies.h (7650, 2018-01-31)
note.h (2392, 2018-01-31)
noteFrequencyChart.xlsx (13982, 2018-01-31)
# ArduinoProgrammableSoundGenerator
An Arduino NES inspired multichannel sounds generator library.
# How to use it
Plug a speaker to pin 3, then init the sound generator in the setup function.
```
#include "APSG.h"
void setup()
{
init_SID();
}
```
Play a 440Hz triangle wave for 1 second, then stop.
```
triangle.note = N_A4;
delay(1000);
triangle.note = N_NOP;
```
Play 2 tones at the same time.
```
squares[0].note = N_A4;
squares[1].note = N_A5;
```
Set volume for specific channel to maximum.
```
noise.volume = 15;
```
Sweep a channel down to low frequency.
```
sawtooth.sweep_direction = SWEEP_DOWN;
sawtooth.sweep_shift = 1;
sawtooth.sweep_speed = SWEEP_SPEED(8);
```
There are other examples in the ino file. For instance, a couple of multichannel melodies. Try them out!
近期下载者:
相关文件:
收藏者: