Giter VIP home page Giter VIP logo

arduinoprogrammablesoundgenerator's Introduction

An Arduino NES inspired multichannel sounds generator library.

Video (click on picture)

HEY, LISTEN!

My modifications

  • the use of progmem for storing melodies has been greatly optimized;
  • it's now possible to apply a smooth fading of notes to each track;
  • bonus: dynamic led indication for each channel.

Besides, I wrote python script that converts specially prepared midi files to melody arrays. Unfortunately, at the moment the delays have to be selected manually.

How to prepare midi file

Important! Set ticks per beat/PPQ to 960 or use midi file from examples as template.

5 simple rules:

  • one note at one time for each track. No overlaps
  • minimal note length - 1/32
  • two identical notes running in a row on the same channel will sound like one long note
  • midi file must be contain 5 tracks
  • track with drums must be named "Drums"

I recommend to use multiplatform midi editor Aria Maestosa.

How to use converter script

python mididump_v3.py <midi file> -old_method

Copy array from console and insert it to melodies.h

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!

arduinoprogrammablesoundgenerator's People

Contributors

nosefu avatar benjamin-lapointe-pinel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.