Giter Site home page Giter Site logo

mehmetcanbudak / teensy-quencer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from newdigate/teensy-quencer

0.0 2.0 0.0 558 KB

my attemp to make a little sequencer using teensy audio library... work in progress!!!

License: MIT License

CMake 0.63% Shell 0.06% C++ 98.80% C 0.51%

teensy-quencer's Introduction

teensyquencer

wip teensy40 Ubuntu-x64

Experimental multi-channel sequencer for teensy

  • each channel has a number of patterns. each pattern has its own length
  • setting next pattern on a channel will take effect once current pattern on that channel is complete.
  • Im using an akai apc40 controller to select patterns for channels - please fork and adapt to your own controller...
  • comming soon - star this repo if you want to see these features
    • midi import and export
    • playing samples at different pitches
    • parameter, midi, audio recording and playback

Audio signal path

dependencies

teensy-quencer on youtube youtube: 10cc - Dreadlock Holiday played on a Teensy 4.0

code

  • define multisequencer:
tempo tempo(120.0f);
multisequencer multisequencer(tempo);
midisequenceadapter adapter(multisequencer); // to read midi files into the a sequencer pattern
  • add sequencer channel(s):
  sequencer *sequencer1 = multisequencer.newSequencer();
  sequencer *sequencer2 = multisequencer.newSequencer();
  • add event callbacks:
  sequencer1->onevent = [] (sequencerevent *event) {
      switch(event->channel) {
        case 0: triggerAudioEvent(event, playSdRaw1, "KICK.WAV"); break;
        case 1: triggerAudioEvent(event, playSdRaw2, "SNARE.WAV"); break;      
        default: break;
      }
  };
  
  sequencer2->onevent = [] (sequencerevent *event) {
      switch(event->channel) {
        case 0: 
          if (event->isNoteStartEvent) {
            sine1.frequency( event->rate * 65.41);
            envelope1.noteOn();
          } else {
            envelope1.noteOff();
          }
        default: break;
      }
  };
  
  • add pattern:
  //                        !               !               !               !      
  const char* pattern4x4 = "X...X...X...X...X...X...X...X...X...X...X...X...X...X...X...X..."; 
  const char* patternSnr = "....x.......x.......x.......x.......x.......x.......x.......x..."; 

  // sequencer1
  int pattern = sequencer1->addPattern(4); // empty pattern: 4 bars;
  
  pattern = sequencer1->addPattern(4); // kick solo 4 x 4: 4 bars
  readPattern(0, pattern, pattern4x4, sequencer); //kick

  pattern = sequencer1->addPattern(4); // kick solo 4 x 4 + snare: 4 bars;
  readPattern(0, pattern, pattern4x4, sequencer); //kick
  readPattern(1, pattern, patternSnr, sequencer); //snare
  
  // load 'snare.mid' smf into next pattern of sequencer1
  adapter.loadMidi("snare.mid");
  adapter.loadMidifileToNextChannelPattern(0, 0, 8);  // multisequencer channel number=0 (==sequencer1), midi track number=0, 8 bars long
  adapter.close();


  // sequencer2
  pattern = sequencer2->addPattern(4); // empty pattern: 4 bars;

  // load 'dredbass.mid' smf into next pattern of sequencer2
  adapter.loadMidi("dredbass.mid");
  adapter.loadMidifileToNextChannelPattern(1, 0, 128, 24); // multisequencer channel number=1 (==sequencer2), midi track number=0, 128 bars long, transpose 24 notes
  adapter.close();

compiling for teensy

You will need to add c++ std library to your compiler flags in boards.txt (Teensyduino/Java/hardware/teensy/avr/boards.txt)

  • remove -nostdlib from teensy40.build.flags.common
  • add -lstdc++ to teensy40.build.flags.cpp
teensy40.build.flags.common=-g -Wall -ffunction-sections -fdata-sections
teensy40.build.flags.cpp=-std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -lstdc++

teensy-quencer's People

Contributors

newdigate avatar

Watchers

James Cloos avatar  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.