Inheritance: MonoBehaviour
Exemplo n.º 1
0
 public FluidMusicSystem()
 {
     Settings settings = new Settings();
     this.synth = new Synthesizer(settings);
     this.driver = new AudioDriver(settings,synth);
     synth.SFontLoad("sndfont2.sf2");
 }
Exemplo n.º 2
0
            public void FillBuffer(Synthesizer synthesizer)
            {
                if (delay > 0)
                {
                    delay--;
                }

                if (delay == 0)
                {
                    delay = ReadSingleEventGroup();
                    SendEvents(synthesizer);

                    if (delay == -1)
                    {
                        synthesizer.NoteOffAll(true);

                        if (loop)
                        {
                            Reset();
                        }
                    }
                }

                synthesizer.GetNext();
            }
Exemplo n.º 3
0
 public Midi(BinaryReader reader, Synthesizer synth)
 {
     _reader = reader;
     _isVerified = false;
     _verificationSuccessfull = false;
     _synthesizer = synth;
 }
Exemplo n.º 4
0
        public static void Start()
        {
            // |-------[ Folders & Files ]-------| //
            if (Reference.Folders.Count() > 0)
            {
                // Create folders
                foreach (String _Folder in Reference.Folders)
                {
                    if (!String.IsNullOrEmpty(_Folder))
                    {
                        Directory.CreateDirectory(_Folder);
                    }
                }
            }

            // IronPythonLib
            File.WriteAllBytes(Reference.IronModules, Resources.IronPythonLib);

            // |-------[ Settings ]-------| //
            Settings.Init();
            // |-------[ Languages ]-------| //
            Langs.Init();

            // |-------[ Visual ]-------| //
            SkinManager.ApplySkin();

            // |-------[ Updates ]-------| //

            // Delete temporary files
            Update.DeleteTemporaryFiles();

            // Update is available
            if (Reference.JsonSettings.Check_for_updates && Update.UpdateAvaible())
            {
                // Ask user to install it, and then install
                if (Update.InstallUpdate(true))
                {
                    // User install the update, stop execution
                    return;
                }
            }

            // |-------[ Views ]-------| //
            Reference.MainWindow = new Main();

            // |-------[ Recognition ]-------| //
            Synthesizer.Init();
            SpeechRecognition.Init();

            // |-------[ Profiles ]-------| //
            Profiles.Init();

            // Hide SplashScreen
            Application.Current.MainWindow.Hide();
            // Show MainWindow
            Reference.MainWindow.Show();

            Utils.Log(Langs.Get("wolfy_loaded"));
        }
Exemplo n.º 5
0
 public void Release(IonianTone tone)
 {
     if (toneMap.TryGetValue(tone, out var index))
     {
         toneMap.Remove(tone);
         Synthesizer.Release(index);
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public SAPIEngine()
        {
            SAPISettings.PreferencesFilePath = UserManager.GetFullPath(SettingsFileName);
            SAPISettings = SAPISettings.Load();

            Synthesizer.SetOutputToDefaultAudioDevice();
            Synthesizer.BookmarkReached += speechSynthesizer_BookmarkReached;
        }
Exemplo n.º 7
0
 public Sequencer(Synthesizer owner)
 {
     targetSynth                 = owner;
     sequencePosition            = 0;
     clock.PulseUpdated         += OnPulseUpdated;
     clock.straightPulseUpdated += OnStraightUpdate;
     clock.swingPulseUpdated    += OnSwingUpdate;
 }
Exemplo n.º 8
0
        private void InitSpeechAndChatbot()
        {
            Synthesizer.Setup();

            Synthesizer.SelectVoiceByName(GlobalData.Voice3);

            Conversation.Init();
        }
Exemplo n.º 9
0
        public FluidMusicSystem()
        {
            Settings settings = new Settings();

            this.synth  = new Synthesizer(settings);
            this.driver = new AudioDriver(settings, synth);
            synth.SFontLoad("sndfont2.sf2");
        }
 void OnDisable()
 {
     Synthesizer.Terminate();
     Mixer.Terminate();
     Sequencer   = null;
     Synthesizer = null;
     Mixer       = null;
 }
Exemplo n.º 11
0
        public ActionResult <Response> UpdateSynthesizer(Synthesizer synthesizer)
        {
            response = new Response();

            response = synthesizerService.UpdateSynthesizer(synthesizer);

            return(responseFactory.CreateControllerResponse(response));
        }
Exemplo n.º 12
0
 // Start is called before the first frame update
 void Start()
 {
     src = gameObject.GetComponent <AudioSource>();
     if (synthesizer == null)
     {
         synthesizer = new Synthesizer(sampleRate, 1, bufferSize, 1);
     }
 }
Exemplo n.º 13
0
 public SynthThread()
 {
     synth          = new Synthesizer(Properties.Settings.Default.SampleRate, 2, Properties.Settings.Default.BufferSize, Properties.Settings.Default.BufferCount, Properties.Settings.Default.poly);
     mseq           = new MidiFileSequencer(synth);
     synth_provider = new SynthWaveProvider(synth, mseq);
     direct_out     = new DirectSoundOut(Properties.Settings.Default.Latency);
     direct_out.Init(synth_provider);
 }
Exemplo n.º 14
0
 public IActionResult OnGet(int id)
 {
     Synthesizer = _synthesizerData.Get(id);
     if (Synthesizer == null)
     {
         return(RedirectToAction("Index", "Home"));
     }
     return(Page());
 }
Exemplo n.º 15
0
        private static void RunProgram(Options options)
        {
            IMapper <Options, SpeechSettings> settingsMapper = new SettingsMapper();
            SpeechSettings settings = settingsMapper.Map(options);

            Synthesizer synthesizer = BootstrapSynthesizer();

            synthesizer.Synthetize(settings);
        }
Exemplo n.º 16
0
 public static void ResetAll()
 {
     Starting = true;
     Synthesizer.SetSpeed(-1);
     TablePositionHelper.LoadTablesInfo();
     TablePositionHelper.DeleteChosenStudentList();
     ChosenStudentList       = new List <string>();
     StudentFeedbackReceived = false;
 }
Exemplo n.º 17
0
        public VocalSampler(Synthesizer synth, Phoneme vowel)
            : base(synth)
        {
            bands = new[]
            {
                // open-mid back unrounded vowel
                //new BandPassFilter(2600, 2700, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F3},
                //new BandPassFilter(1170, 1170, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F2},
                //new BandPassFilter(600, 600, synth.SampleRate, LowResonance, LowResonance) {Volume = LEVEL_F1},

                // open-mid front unrounded vowel
                new BandPassFilter(3500, 3600, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F4},
                new BandPassFilter(2600, 2700, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F3},
                new BandPassFilter(1800, 1900, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F2},
                new BandPassFilter(650, 800, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F1},

                // close front rounded vowel
                //new BandPassFilter(3200, 3300, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F4},
                //new BandPassFilter(2100, 2200, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F3},
                //new BandPassFilter(1800, 1900, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F2},
                //new BandPassFilter(200, 300, synth.SampleRate, LowResonance, LowResonance) {Volume = LEVEL_F1},

                // near-open front unrounded vowel
                //new BandPassFilter(2900, 3000, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F3},
                //new BandPassFilter(1700, 1800, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F2},
                //new BandPassFilter(800, 900, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F1},

                // postalveolar approximant
                //new BandPassFilter(3000, 3000, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F3},
                //new BandPassFilter(1400, 1400, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F2},
                //new BandPassFilter(350, 350, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F1},

                // close-mid front unrounded vowel
                //new BandPassFilter(3600, 3700, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F4},
                //new BandPassFilter(2500, 2600, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F3},
                //new BandPassFilter(2200, 2300, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F2},
                //new BandPassFilter(450, 500, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F1},

                // close front unrounded vowel
                //new BandPassFilter(3000, 3000, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F3},
                //new BandPassFilter(2250, 2250, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F2},
                //new BandPassFilter(250, 250, synth.SampleRate, HighResonance, HighResonance) {Volume = LEVEL_F1},

                // voiceless palatal-alveolar sibilant fricative
                //new BandPassFilter(200, 1200, synth.SampleRate, 1.0f, 1.0f) { Volume = 0.075f },
                //new BandPassFilter(1900, 5500, synth.SampleRate, .35f, .35f) { Volume = 0.01f },
                //new BandPassFilter(2100, 2500, synth.SampleRate, .2f, .2f) { Volume = 0.1f },
                //new BandPassFilter(3700, 4100, synth.SampleRate, .2f, .2f) { Volume = 0.050f },
                //new BandPassFilter(4600, 5400, synth.SampleRate, .18f, .18f) { Volume = 0.060f },
                //new BandPassFilter(6700, 7200, synth.SampleRate, .1f, .1f) { Volume = 0.0060f },
            };

            lowPass = new ButterworthFilter(500, synth.SampleRate, PassFilterType.LowPass, .1f);
            highPass = new ButterworthFilter(6000, synth.SampleRate, PassFilterType.HighPass, .4f);

            numBands = bands.Length;
        }
Exemplo n.º 18
0
 public override void Recognize(object sender, SpeechRecognizedEventArgs e)
 {
     Console.WriteLine("[BASE] Received command: {0}", e.Result);
     if (e.Result.Text.Contains("recognition"))
     {
         Synthesizer.Speak("Exiting Jarvis, thanks for using");
         Environment.Exit(0);
     }
 }
Exemplo n.º 19
0
        private static Synthesizer BootstrapSynthesizer()
        {
            IValidator <SpeechSettings> validator         = new SpeechSettingsValidator();
            SpeechSynthesizer           systemSynthesizer = new SpeechSynthesizer();

            Synthesizer result = new Synthesizer(validator, systemSynthesizer);

            return(result);
        }
Exemplo n.º 20
0
 public SineLayer(Synthesizer synth, double fa, double fb, double amplitude, double phase = 0.0f, double dcOffset = 0.0f) : base(synth)
 {
     FrequencyA = fa;
     FrequencyB = fb;
     Amplitude  = amplitude;
     Phase      = phase;
     stateA     = phase;
     stateB     = phase;
     DCOffset   = dcOffset;
 }
        public async Task <IActionResult> Edit(Synthesizer item)
        {
            if (ModelState.IsValid)
            {
                await _synthesizerRepo.UpdateAsync(item);

                return(RedirectToAction("Index", "Home"));
            }
            return(View(item));
        }
Exemplo n.º 22
0
            public void ProcessMidiEvents(Synthesizer synthesizer)
            {
                if (sequencer == null)
                {
                    sequencer = new MidiFileSequencer(synthesizer);
                    sequencer.Play(midi, loop);
                }

                sequencer.ProcessEvents();
            }
Exemplo n.º 23
0
        public Response UpdateSynthesizer(Synthesizer synthesizer)
        {
            response = responseFactory.CreateSynthesizerResponse();

            response.synthesizer.id = magmaDbContext.Update <Synthesizer>(synthesizer).Entity.id;

            magmaDbContext.SaveChanges();

            return(responseFactory.UpdateResponse(response, "Success: updated synthesizer", ResponseStatus.OK));
        }
Exemplo n.º 24
0
    public void NoteOn(int noteNumber, float velocity)
    {
        this.noteNumber = noteNumber;
        this.velocity   = velocity;

        frequency = Synthesizer.NoteToFrequency(noteNumber);

        phase      = 0;
        sampleRate = (float)AudioSettings.outputSampleRate;
    }
Exemplo n.º 25
0
            public void RenderWaveform(Synthesizer synthesizer, Span <float> left, Span <float> right)
            {
                if (sequencer == null)
                {
                    sequencer = new MidiFileSequencer(synthesizer);
                    sequencer.Play(midi, loop);
                }

                sequencer.Render(left, right);
            }
        protected void OnDestroy()
        {
            Sequencer.Reset();
            Synthesizer.Reset();

            if (hierarchyTransform == transform)
            {
                hierarchyTransform = null;
            }
        }
        private bool InitSynth()
        {
            // Get peer AudioSource
            audioSource = GetComponent <AudioSource>();
            if (audioSource == null)
            {
                DaggerfallUnity.LogMessage("DaggerfallSongPlayer: Could not find AudioSource component.");
                return(false);
            }

            // Create synthesizer and load bank
            if (midiSynthesizer == null)
            {
                // Get number of channels
                if (AudioSettings.driverCapabilities.ToString() == "Mono")
                {
                    channels = 1;
                }
                else
                {
                    channels = 2;
                }

                // Create synth
                AudioSettings.GetDSPBufferSize(out bufferLength, out numBuffers);
                midiSynthesizer = new Synthesizer(sampleRate, channels, bufferLength / numBuffers, numBuffers, polyphony);

                // Load bank data
                byte[] bankData = LoadBank(SoundBank);
                if (bankData == null)
                {
                    return(false);
                }
                else
                {
                    midiSynthesizer.LoadBank(new MyMemoryFile(bankData, SoundBank));
                    midiSynthesizer.ResetSynthControls(); // Need to do this for bank to load properly, don't know why
                }
            }

            // Create sequencer
            if (midiSequencer == null)
            {
                midiSequencer = new MidiFileSequencer(midiSynthesizer);
            }

            // Check init
            if (midiSynthesizer == null || midiSequencer == null)
            {
                DaggerfallUnity.LogMessage("DaggerfallSongPlayer: Failed to init synth.");
                return(false);
            }

            return(true);
        }
Exemplo n.º 28
0
 public void Start()
 {
     if (targetSynth != null)
     {
         playing = true;
     }
     else
     {
         targetSynth = new Synthesizer();
     }
 }
Exemplo n.º 29
0
        public SynthWaveProvider(Synthesizer synth, MidiFileSequencer mseq)
        {
            this.synth = synth;
            this.mseq  = mseq;
            waveFormat = new WaveFormat(synth.SampleRate, 16, synth.AudioChannels);
            int bufferSize = (int)Math.Ceiling((2.0 * waveFormat.AverageBytesPerSecond) / synth.RawBufferSize) * synth.RawBufferSize;

            circularBuffer = new CircularBuffer(bufferSize);
            sbuff          = new byte[synth.RawBufferSize];
            state          = PlayerState.Stopped;
        }
Exemplo n.º 30
0
 public MidiFileSequencer(Synthesizer synth)
 {
     Synth         = synth;
     _eventIndex   = 0;
     _division     = 0;
     _playbackRate = 1;
     IsPlaying     = false;
     _blockList    = new bool[SynthConstants.DefaultChannelCount];
     _finished     = new FastList <Action>();
     synth.AddMidiMessageProcessed(MidiEventProcessed);
 }
Exemplo n.º 31
0
        public void Attack(IonianTone tone)
        {
            if (toneMap.ContainsKey(tone))
            {
                return;
            }

            var freq  = Scale.GetFrequency(tone);
            var index = Synthesizer.Attack(new Oscillator[] { new Oscillator(Wave.CurrentState, freq, OscillatorVolume) });

            toneMap[tone] = index;
        }
Exemplo n.º 32
0
            public void FillBuffer(Synthesizer synthesizer)
            {
                if (sequencer == null)
                {
                    sequencer = new MidiFileSequencer(synthesizer);
                    sequencer.LoadMidi(midi);
                    sequencer.Play();
                }

                sequencer.FillMidiEventQueue(loop);
                synthesizer.GetNext();
            }
Exemplo n.º 33
0
        public override void OnUpdate(Synthesizer synth)
        {
            double localTime = GetRelativeSeconds(synth);

            if (localTime >= synth.Voice.GlottisCloseTime)
            {
                synth.State.GlottisLevel = 0.0;
                return;
            }

            synth.State.GlottisLevel = (1.0 - localTime / synth.Voice.GlottisCloseTime) * synth.State.LastGlottisLevel;
        }
Exemplo n.º 34
0
        public Synthesizer CreateSynthesizer(int deviceId, int bufferSize, int sampleRate)
        {
            synth = new Synthesizer(
                "Lite Wave",
                deviceId,
                bufferSize,
                sampleRate,
                new VoiceFactory(delegate(SampleRate sr, StereoBuffer buffer, string name)
                {
                    return new SynthVoice(sr, buffer, name);
                }),
                8,
                delegate(SampleRate sr, StereoBuffer inputBuffer)
                {
                    List<EffectComponent> myEffects = new List<EffectComponent>();

                    myEffects.Add(new Sanford.Multimedia.Synth.Chorus(sr, inputBuffer));
                    myEffects.Add(new Sanford.Multimedia.Synth.Echo(sr, inputBuffer));

                    return myEffects;
                });

            if (File.Exists("LiteWaveDefaultBank.bnk"))
            {
                try
                {
                    // Load default bank into Lite Wave synthesizer.
                    synth.LoadBank("LiteWaveDefaultBank.bnk");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Stop);
                }
            }
            else
            {
                MessageBox.Show("No Soundbank Found", "Error", MessageBoxButton.OK, MessageBoxImage.Stop);
            }
            synth.SetParameterValue(11, (float)1.0);

            //Set to organ
            synth.SetSelectedProgramIndex(2);

            return synth;
        }
Exemplo n.º 35
0
        private bool InitSynth()
        {
            // Get peer AudioSource
            audioSource = GetComponent<AudioSource>();
            if (audioSource == null)
            {
                DaggerfallUnity.LogMessage("DaggerfallSongPlayer: Could not find AudioSource component.");
                return false;
            }

            // Create synthesizer and load bank
            if (midiSynthesizer == null)
            {
                // Get number of channels
                if (AudioSettings.driverCapabilities.ToString() == "Mono")
                    channels = 1;
                else
                    channels = 2;

                // Create synth
                AudioSettings.GetDSPBufferSize(out bufferLength, out numBuffers);
                midiSynthesizer = new Synthesizer(sampleRate, channels, bufferLength / numBuffers, numBuffers, polyphony);

                // Load bank data
                byte[] bankData = LoadBank(SoundBank);
                if (bankData == null)
                    return false;
                else
                {
                    midiSynthesizer.LoadBank(new MyMemoryFile(bankData, SoundBank));
                    midiSynthesizer.ResetSynthControls(); // Need to do this for bank to load properly, don't know why
                }
            }

            // Create sequencer
            if (midiSequencer == null)
                midiSequencer = new MidiFileSequencer(midiSynthesizer);

            // Check init
            if (midiSynthesizer == null || midiSequencer == null)
            {
                DaggerfallUnity.LogMessage("DaggerfallSongPlayer: Failed to init synth.");
                return false;
            }

            return true;
        }