void Awake() { if (!instance) { instance = this; } midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); // Arduino //sp.Open(); //sp.ReadTimeout=1; for (i = 0; i < 128; i++) { currentNote[i] = 0; pressed[i] = 0; } //Debug.Log(Kbd_UserInput.kbd_num); //These will be fired by the midiSequencer when a song plays midiSequencer.NoteOnEvent += new MidiSequencer.NoteOnEventHandler(MidiNoteOnHandler); midiSequencer.NoteOffEvent += new MidiSequencer.NoteOffEventHandler(MidiNoteOffHandler); }
// Awake is called when the script instance // is being loaded. void Awake() { MidiFile midiFile = new MidiFile(midiFilePath); foreach (var VARIABLE in midiFile.Tracks) { Debug.Log(VARIABLE); } Debug.Log("\n\n"); Debug.Log(midiFile.BeatsPerMinute); Debug.Log(midiFile.BeatsPerMinute); Debug.Log(midiFile.MidiHeader.MidiFormat); foreach (var VARIABLE in midiFile.Tracks[0].MidiEvents) { Debug.Log(VARIABLE); } midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); //These will be fired by the midiSequencer when a song plays. Check the console for messages if you uncomment these midiSequencer.NoteOnEvent += new MidiSequencer.NoteOnEventHandler(MidiNoteOnHandler); // midiSequencer.NoteOffEvent += new MidiSequencer.NoteOffEventHandler (MidiNoteOffHandler); Nuotti = GameObject.Find("Nuotti").GetComponent <Text>(); }
void Awake() { midiStreamSynthesizer = new StreamSynthesizer(samplerate, 2, bufferSize, _polyCount); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); midiSequencer.Looping = true; midiSequencer.OnLoop += AddLoopOffset; _shouldPlayFile = false; _menuManager = FindObjectOfType <MenuManager>(); _menuManager.OnStartGame += StartMetronome; _menuManager.OnGameOver += StopMetronome; _metronome = FindObjectOfType <Metronome>(); _metronome.BeatSubscribe(DoBeep); _metronome.BeatEvent += Play; _gridSystem = GetComponent <GridSystem>(); _infGrid = (InfiniteHexGrid)_gridSystem.Grid; #if UNITY_WEBGL AudioSettings.outputSampleRate = samplerate; var aud = GetComponent <AudioSource>(); aud.clip = AudioClip.Create("Proc", midiStreamSynthesizer.BufferSize, 1, samplerate, true, Reader, SetAudioPosition); aud.Play(); #endif }
// Awake is called when the script instance // is being loaded. void Awake() { #if UNITY_ANDROID && !UNITY_EDITOR midiStreamSynthesizer = new StreamSynthesizer(44100, 1, bufferSize, 40); #else midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); #endif sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); if (midiSource == MidiSource.File) { midiSequencer = new MidiSequencer(midiStreamSynthesizer); midiSequencer.TempoScale = tempoScale; //These will be fired by the midiSequencer when a song plays midiSequencer.NoteOnEvent += new MidiSequencer.NoteOnEventHandler(MidiNoteOnHandler); midiSequencer.NoteOffEvent += new MidiSequencer.NoteOffEventHandler(MidiNoteOffHandler); } else if (midiSource == MidiSource.MidiIn) { midiUdpListener = new MidiUdpListener(); midiUdpListener.NoteOn += MidiInNoteOn; midiUdpListener.NoteOff += MidiInNoteOff; noteEvents = new int[0]; } }
void InicilizarSintetizador() { midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); }
// Awake is called when the script instance // is being loaded. void Awake() { midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); }
public Sound(string bank, string midifile) { midiStreamSynthesizer = new StreamSynthesizer(StreamSynthesizer.SampleRateType.High); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bank); midiSequencer = new MidiSequencer(midiStreamSynthesizer); midiSequencer.LoadMidi(midifile, false); midiSequencer.Play(); }
// Awake is called when the script instance // is being loaded. void Awake() { midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); //These will be fired by the midiSequencer when a song plays. Check the console for messages if you uncomment these //midiSequencer.NoteOnEvent += new MidiSequencer.NoteOnEventHandler (MidiNoteOnHandler); //midiSequencer.NoteOffEvent += new MidiSequencer.NoteOffEventHandler (MidiNoteOffHandler); }
void Awake() { midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); _metronome = FindObjectOfType <Metronome>(); _metronome.BeatSubscribe(DoBeep); _metronome.BeatEvent += Play; }
//bool[] curNoteOff = new bool[130]; void Awake() { if (!instance) { instance = this; } midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); // Arduino //sp.Open(); //sp.ReadTimeout=1; for (i = 0; i < 130; i++) { tempval[i] = "0"; sensorInput[i] = 0; inputFlag[i] = 0; strokeFlag[i] = 0; curNoteOn[i] = false; //curNoteOff[i] = false; } for (i = 1; i < 7; i++) { defGtr_isEmpty[i] = true; } defGtrLine[1] = 40; defGtrLine[2] = 45; defGtrLine[3] = 50; defGtrLine[4] = 55; defGtrLine[5] = 59; defGtrLine[6] = 64; sensorInput[40] = 1; sensorInput[45] = 1; sensorInput[50] = 1; sensorInput[55] = 1; sensorInput[59] = 1; sensorInput[64] = 1; //These will be fired by the midiSequencer when a song plays. Check the console for messages if you uncomment these midiSequencer.NoteOnEvent += new MidiSequencer.NoteOnEventHandler(MidiNoteOnHandler); midiSequencer.NoteOffEvent += new MidiSequencer.NoteOffEventHandler(MidiNoteOffHandler); }
// Awake is called when the script instance // is being loaded. public void PlayMusic(byte[] midi) { loadedMidi = midi; midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); LoadSong(midi); playing = true; //These will be fired by the midiSequencer when a song plays. Check the console for messages if you uncomment these //midiSequencer.NoteOnEvent += new MidiSequencer.NoteOnEventHandler (MidiNoteOnHandler); //midiSequencer.NoteOffEvent += new MidiSequencer.NoteOffEventHandler (MidiNoteOffHandler); }
void Awake() { midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); instrumentSelect = GameObject.Find("Instrument Select").GetComponent <TMPro.TMP_Dropdown>(); //These will be fired by the midiSequencer when a song plays. Check the console for messages if you uncomment these //midiSequencer.NoteOnEvent += new MidiSequencer.NoteOnEventHandler (MidiNoteOnHandler); //midiSequencer.NoteOffEvent += new MidiSequencer.NoteOffEventHandler (MidiNoteOffHandler); }
// Awake is called when the script instance // is being loaded. void Awake() { midiFilePath = Application.persistentDataPath + "/Midis/" + ButtonPrefab.nameOfSong + ".txt"; txtPath.text = midiFilePath; midiStreamSynthesizer = new StreamSynthesizer(44100, 1, bufferSize, 40); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); //These will be fired by the midiSequencer when a song plays. Check the console for messages if you uncomment these //midiSequencer.NoteOnEvent += new MidiSequencer.NoteOnEventHandler(MidiNoteOnHandler); //midiSequencer.NoteOffEvent += new MidiSequencer.NoteOffEventHandler (MidiNoteOffHandler); }
private void InitIfNotDoneYet() { if (isInitialized) { return; } midiStreamSynthesizer = new StreamSynthesizer(midiStreamSampleRateHz, 2, bufferSize, 16); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); isInitialized = true; }
public void InitIfNotDoneYet() { if (isInitialized) { return; } midiStreamSynthesizer = new StreamSynthesizer(midiStreamSampleRateHz, 1, bufferSize, 16, 1); newSampleBuffer = new float[midiStreamSynthesizer.BufferSize]; availableSamplesSynthesizerSampleRate = new CircularBuffer <float>(midiStreamSampleRateHz / 10); availableSamplesOutputSampleRate = new CircularBuffer <float>(outputSampleRateHz / 10); midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); isInitialized = true; }
void Awake() { midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); midiSequencer.NoteOnEvent += new MidiSequencer.NoteOnEventHandler(MidiNoteOnHandler); midiSequencer.NoteOffEvent += new MidiSequencer.NoteOffEventHandler(MidiNoteOffHandler); ChangeSong(0); fc = GameObject.Find("FinalScenario").GetComponent <FinalScenario>(); if (useRandomSong) { PlayRandomSong(); } }
// Awake is called when the script instance // is being loaded. void Awake() { #if UNITY_ANDROID && !UNITY_EDITOR midiStreamSynthesizer = new StreamSynthesizer(44100, 1, bufferSize, 40); #else midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); #endif sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); midiSequencer.TempoScale = 1.0f; //These will be fired by the midiSequencer when a song plays midiSequencer.NoteOnEvent += new MidiSequencer.NoteOnEventHandler(MidiNoteOnHandler); midiSequencer.NoteOffEvent += new MidiSequencer.NoteOffEventHandler(MidiNoteOffHandler); // Set Default tuning adjustment to about -1 halftone //midiStreamSynthesizer.TuningAdjustment = -1.0f + AppProperties.TuningAdjustment; }
void Awake() { // For now, imitating the behavior of UnitySynthTest.cs with two goals: // 1. Understand how UnitySynth loads and plays midi files // 2. Figure out where in that process to get the data for the markov chain // copied straight from UnitySynthTest.cs, almost midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40); sampleBuffer = new float[midiStreamSynthesizer.BufferSize]; midiStreamSynthesizer.LoadBank(bankFilePath); midiSequencer = new MidiSequencer(midiStreamSynthesizer); midiSequencer.LoadMidi(testMidiFile, false); midiSequencer.NoteOnEvent += new MidiSequencer.NoteOnEventHandler(MidiNoteOnHandler); midiSequencer.NoteOffEvent += new MidiSequencer.NoteOffEventHandler(MidiNoteOffHandler); initializeMatrix(16, 128 * 128, 128); }