Phoenard
PHNMidi.h
Go to the documentation of this file.
1 /*
2 The MIT License (MIT)
3 
4 This file is part of the Phoenard Arduino library
5 Copyright (c) 2014 Phoenard
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 */
25 
30 #include <Arduino.h>
31 #include "PHNCore.h"
32 
33 #ifndef _PHN_MIDI_H_
34 #define _PHN_MIDI_H_
35 
50 class PHN_Midi {
51  public:
53  void begin();
55  void setInstrument(byte instrument);
57  void setBank(byte bank);
59  void noteOn(byte channel, byte note, byte attack_velocity);
61  void noteOff(byte channel, byte note, byte release_velocity);
63  void note(byte channel, byte note, byte velocity, boolean pressed);
65  void talkMIDI(byte cmd, byte data1, byte data2);
67  void playNote(byte note);
69  void write(uint8_t byte);
70 };
71 
72 #endif
void note(byte channel, byte note, byte velocity, boolean pressed)
Sets whether a note is pressed or released, similar to noteOn/noteOff.
Definition: PHNMidi.cpp:69
void noteOff(byte channel, byte note, byte release_velocity)
turns a note off (release)
Definition: PHNMidi.cpp:64
void setBank(byte bank)
Sets the instrument bank to use.
Definition: PHNMidi.cpp:48
void talkMIDI(byte cmd, byte data1, byte data2)
Main MIDI command sending routine.
Definition: PHNMidi.cpp:80
void playNote(byte note)
Plays a note at channel 0 and releases - useful for debugging.
Definition: PHNMidi.cpp:114
void noteOn(byte channel, byte note, byte attack_velocity)
Turns a note on (press)
Definition: PHNMidi.cpp:59
Pinout information for the Phoenard hardware components.
void write(uint8_t byte)
Writes a single byte to the VS1053 chip.
Definition: PHNMidi.cpp:90
void setInstrument(byte instrument)
Sets the instrument to play with.
Definition: PHNMidi.cpp:52
void begin()
Initializes the chip into MIDI mode.
Definition: PHNMidi.cpp:28
Play music notes using a variety of instruments using MIDI with chip VS1053B.
Definition: PHNMidi.h:50