/// <summary>
        /// Change Fog Color Tone
        /// </summary>
		bool Command205()
        {
			// Start Color tone change
            Tone tone = new Tone(intParams[0], intParams[1], intParams[2], intParams[3]);
			InGame.Map.StartFogToneChange(tone, intParams[4] * 2);
			// Continue
            return true;
		}
Exemple #2
0
 public void set(Tone c)
 {
     if (c == null) return;
     red = c.red;
     green = c.green;
     blue = c.blue;
     gray = c.gray;
 }
 private static void generateManifest(Stream outManifest, Tone.Tone tone)
 {
     var manifest = new Tone.Manifest();
     manifest.Entries.Add(tone);
     var data = JsonConvert.SerializeObject(manifest, Formatting.Indented);
     var writer = new StreamWriter(outManifest);
     writer.Write(data);
     writer.Flush();
     outManifest.Seek(0, SeekOrigin.Begin);
 }
Exemple #4
0
        public ToneViewer(Tone tone)
        {
            InitializeComponent();

            _tone = tone;

            Hue.RawValue            = _tone.Hue;
            SaturationHigh.RawValue = _tone.SaturationHigh * 100;
            SaturationLow.RawValue  = _tone.SaturationLow * 100;
            ValueHigh.RawValue      = _tone.ValueHigh * 100;
            ValueLow.RawValue       = _tone.ValueLow * 100;
        }
Exemple #5
0
        public void SetToneRandomly(Random rng)
        {
            if (rng == null)
            {
                rng = new Random();
            }

            var possibilities = IncidentEnumExtensions.GetPossibleTones(TheEnergyVariation, TheStressVariation);
            var diceRoll      = rng.Next(0, possibilities.Count);

            theTone = possibilities[diceRoll];
        }
        public void TestSerialize(int scale, bool half, string json)
        {
            var tone = new Tone
            {
                Scale = scale,
                Half  = half,
            };

            var result = JsonConvert.SerializeObject(tone, CreateSettings());

            Assert.AreEqual(result, $"{json}");
        }
Exemple #7
0
        private void WriteNote(WaveStreamWriter streamWriter, string name, int durationBefore, int duration, int amplitude)
        {
            Tone tone = Tones.Item(name);

            if (durationBefore > 0)
            {
                streamWriter.WriteSilenceChunk(durationBefore);
            }

            streamWriter.WriteChunk(SampleHelper.MakeBassChunk2(duration, tone.Frequency, amplitude, 2));
            //streamWriter.WriteOscillator(new Oscillator(WaveType.Sine, duration, tone.Frequency, amplitude, 2));
        }
Exemple #8
0
        private void performColumnMovement(Tone lastTone, MoveSelectionEvent <HitObject> moveEvent)
        {
            if (!(moveEvent.Blueprint is NoteSelectionBlueprint))
            {
                return;
            }

            // top position
            var screenSpacePosition = moveEvent.Blueprint.ScreenSpaceSelectionPoint + moveEvent.ScreenSpaceDelta;
            var dragHeight          = NotePlayfield.ToLocalSpace(screenSpacePosition).Y;
            var lastHeight          = convertToneToHeight(lastTone);
            var moveHeight          = dragHeight - lastHeight;

            var         deltaTone      = new Tone();
            const float trigger_height = ScrollingNotePlayfield.COLUMN_SPACING + DefaultColumnBackground.COLUMN_HEIGHT;

            if (moveHeight > trigger_height)
            {
                deltaTone = -new Tone {
                    Half = true
                }
            }
            ;
            else if (moveHeight < 0)
            {
                deltaTone = new Tone {
                    Half = true
                }
            }
            ;

            if (deltaTone == 0)
            {
                return;
            }

            foreach (var note in EditorBeatmap.SelectedHitObjects.OfType <Note>())
            {
                if (note.Tone >= calculator.MaxTone() && deltaTone > 0)
                {
                    continue;
                }
                if (note.Tone <= calculator.MinTone() && deltaTone < 0)
                {
                    continue;
                }

                note.Tone += deltaTone;

                //Change all note to visible
                note.Display = true;
            }
        }
Exemple #9
0
        static void Encode(BinaryWriter writer, Tone o)
        {
            EncodeID(writer, typeof(Tone));

            writer.Write(o.Hue);

            writer.Write(o.SaturationHigh);
            writer.Write(o.SaturationLow);

            writer.Write(o.ValueHigh);
            writer.Write(o.ValueLow);
        }
Exemple #10
0
        private static void generateManifest(Stream outManifest, Tone tone)
        {
            var manifest = new Manifest.Tone.Manifest();

            manifest.Entries.Add(tone);
            var data   = JsonConvert.SerializeObject(manifest, Formatting.Indented);
            var writer = new StreamWriter(outManifest);

            writer.Write(data);
            writer.Flush();
            outManifest.Seek(0, SeekOrigin.Begin);
        }
Exemple #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="table"></param>
        /// <param name="tones"></param>
        private static void readOpnBank(Dictionary <string, Dictionary <string, string> > table, List <Tone> tones)
        {
            for (int progNo = 0; progNo < 128; progNo++)
            {
                Tone tone = new Tone();

                tone.Number = progNo;

                var val = getValue(table, "Prog" + progNo, "Name");
                if (!string.IsNullOrWhiteSpace(val))
                {
                    tone.Name = val;
                }

                val = getValue(table, "Prog" + progNo, "ALFB");
                if (string.IsNullOrWhiteSpace(val))
                {
                    continue;
                }
                var vals = extractParams(val);

                tone.AL = vals[0];
                tone.FB = vals[1];

                for (int opNo = 0; opNo < 4; opNo++)
                {
                    val = getValue(table, "Prog" + progNo, "OP" + (opNo + 1));
                    if (string.IsNullOrWhiteSpace(val))
                    {
                        tone = null;
                        break;
                    }
                    vals = extractParams(val);

                    tone.aOp[opNo].AR = vals[0];
                    tone.aOp[opNo].DR = vals[1];
                    tone.aOp[opNo].SR = vals[2];
                    tone.aOp[opNo].RR = vals[3];
                    tone.aOp[opNo].SL = vals[4];
                    tone.aOp[opNo].TL = vals[5];
                    tone.aOp[opNo].KS = vals[6];
                    tone.aOp[opNo].ML = vals[7];
                    tone.aOp[opNo].DT = vals[8];
                    tone.aOp[opNo].EG = vals[9];
                    tone.aOp[opNo].AM = vals[10];
                }
                if (tone != null)
                {
                    tones.Add(tone);
                }
            }
        }
Exemple #12
0
 public Tone(Tone tone)
 {
     Name   = tone.Name;
     Number = tone.Number;
     FB     = tone.FB;
     AL     = tone.AL;
     CNT    = tone.CNT;
     aOp    = new Op[4];
     aOp[0] = new Op(tone.aOp[0]);
     aOp[1] = new Op(tone.aOp[1]);
     aOp[2] = new Op(tone.aOp[2]);
     aOp[3] = new Op(tone.aOp[3]);
 }
Exemple #13
0
 public Key(int keyNumber)
 {
     if (keyNumber < 12)
     {
         Scale = Scale.Major;
         Tone  = (Tone)keyNumber;
     }
     else
     {
         Scale = Scale.Minor;
         Tone  = (Tone)(keyNumber - 12);
     }
 }
 public override float this[Tone tone] {
     get {
         var baseSemitone = TONE_NAME_TO_SEMITONE.TryGetStructValue(tone.ToneName);
         if (baseSemitone.HasValue)
         {
             return((float)(a4 * Math.Pow(2, tone.Octave - 4 + (baseSemitone.Value + tone.Accidental) / 12.0)));
         }
         else
         {
             return(0f);
         }
     }
 }
Exemple #15
0
        public OctaveTone GetRandomOctaveTone(int octave = 0)
        {
            Tone tone = GetRandomTone();

            if (octave > 0)
            {
                return(new OctaveTone(tone, octave));
            }
            else
            {
                return(new OctaveTone(tone, UnityEngine.Random.Range(1, 6)));
            }
        }
    public Voice applyVoiceTone(Voice voice, Tone tone)
    {
        Voice curVoice = voice;

        switch (tone)
        {
        case Tone.Anxious:
            curVoice.pitch  += 0.03f;
            curVoice.volume += 0.2f;
            break;
        }
        return(curVoice);
    }
        public static void Generate(string toneKey, Tone.Tone tone, Stream outManifest, Stream outXblock, Stream aggregateGraph)
        {
            var id = IdGenerator.Guid().ToString().Replace("-", "");
            if (string.IsNullOrEmpty(tone.Name))
                tone.Name = toneKey;
            tone.Key = toneKey;
            tone.PersistentID = id;
            tone.BlockAsset = String.Format("urn:emergent-world:DLC_Tone_{0}", toneKey);

            generateManifest(outManifest, tone);
            generateXBlock(toneKey, outXblock, tone);
            generateAggregateGraph(toneKey, aggregateGraph);
        }
    public Voice applyVoiceTone(Voice voice, Tone tone)
    {
        Voice curVoice = voice;
        switch(tone)
        {
            case Tone.Anxious:
                curVoice.pitch += 0.03f;
                curVoice.volume += 0.2f;
                break;

        }
        return curVoice;
    }
Exemple #19
0
        /// <summary>
        /// Creates a new CnsExploration model entity based on the data of
        /// this CnsExploration viewmodel.
        /// </summary>
        public CnsExploration ToNewModel()
        {
            var cnsExploration = new CnsExploration
            {
                Behavior      = Behavior.GetValueOrDefault(),
                CranialNerves = CranialNerves.GetValueOrDefault(),
                Tone          = Tone.GetValueOrDefault(),
                Position      = Position.GetValueOrDefault(),
                Reflexes      = Reflexes.GetValueOrDefault()
            };

            return(cnsExploration);
        }
 ///<summary>Starts the Picture's tone change</summary>
 ///<param Name="changeTone">target tone</param Name>
 ///<param Name="duration">change duration</param Name>
 public void StartToneChange(Tone changeTone, int duration)
 {
     toneTarget    = changeTone.Clone;
     toneDuration  = (int)(duration * GameOptions.AdjustFrameRate);
     startToneRed  = ColorTone.Red;
     startToneGeen = ColorTone.Green;
     startToneBlue = ColorTone.Blue;
     startToneGray = ColorTone.Gray;
     if (toneDuration == 0)
     {
         ColorTone = toneTarget.Clone;
     }
 }
Exemple #21
0
        /// <summary>
        ///  Sets PWM to the tone frequency and starts it.
        /// </summary>
        /// <param name="tone"></param>
        private void SetTone(Tone tone)
        {
            tunePWM.Active = false;

            if (tone.freq == 0)
            {
                tunePWM.Active = false;
                return;
            }

            tunePWM.Set((int)tone.freq, 0.5);
            tunePWM.Active = true;
        }
        public (short, short) GetSample(int index, double sampleRate, Tone t)
        {
            var time = MidiTimingConverter.GetTime(index, (int)sampleRate);


            var i = (int)((index % (100)) * (32 * 0.01));

            if (i > 31)
            {
                i -= 32;
            }
            var          o = Wave[i];
            float        vol;
            EnvelopeFlag flag = EnvelopeFlag.Attack;

            if (time > Envelope.A)
            {
                flag = EnvelopeFlag.Decay;
            }
            if (time > Envelope.A + Envelope.D)
            {
                flag = EnvelopeFlag.Sustain;
            }
            switch (flag)
            {
            case EnvelopeFlag.Attack:
                vol = (float)MathHelper.Linear(time, 0, Envelope.A, 0, 1);
                break;

            case EnvelopeFlag.Decay:
                vol = (float)MathHelper.Linear(time, Envelope.A, Envelope.A + Envelope.D, 1, Envelope.S * 0.0039);
                break;

            case EnvelopeFlag.Sustain:
                vol = Envelope.S * 0.0039f;
                break;

            case EnvelopeFlag.Release:
            case EnvelopeFlag.None:
            default:
                vol = 0;
                break;
            }
            if (t != null)
            {
                t.EnvVolume = vol;
            }
            short a = (short)(Math.Min(short.MaxValue, Math.Max(short.MinValue, o * vol)));

            return(a, a);
        }
Exemple #23
0
        public void ScaleContainsTest(Tone tone, bool expected1, bool expected2, bool expected3)
        {
            Scale s1 = new Scale(Tone.A, Tone.B, Tone.C, Tone.D, Tone.E + 12, Tone.F + 12 * 2);

            Assert.AreEqual(s1.Contains(tone), expected1);

            Scale s2 = new Scale(Tone.ASharp - 12, Tone.B - 12, Tone.C - 12, Tone.F - 12);

            Assert.AreEqual(s2.Contains(tone), expected2);

            Scale s3 = new Scale(Tone.A + 12, Tone.B + 12 * 2, Tone.C + 12 * 3, Tone.D + 12 * 4, Tone.E + 12 * 5, Tone.F + 12 * 6);

            Assert.AreEqual(s3.Contains(tone), expected3);
        }
Exemple #24
0
        public void PlayTest_SimpleNewTone(int octave, Tone tone, int duration, byte velocity, byte expectedToneOffset)
        {
            IOrchestra o = Substitute.For <IOrchestra>();
            Instrument i = new  Instrument(o, InstrumentType.AcousticBass, new Scale(), octave);

            i.Play(tone, duration, velocity);

            List <SingleBeat> expected = new List <SingleBeat>
            {
                new SingleBeat(i.InstrumentType, expectedToneOffset, velocity, 0, duration)
            };

            o.Received().CopyToOutput(Arg.Is <List <SingleBeat> >(value => value.SequenceEqual(expected)));
        }
Exemple #25
0
 /// <summary>
 /// Constructor for creating an alarm where hour input is 0-23
 /// </summary>
 /// <param name="hours"></param>
 /// <param name="minutes"></param>
 /// <param name="seconds"></param>
 /// <param name="set"></param>
 public AlarmMVC(int hours, int minutes, int seconds, bool set, int snooze, Tone ringtone)
 {
     if (set)
     {
         Status = AlarmStatus.Running;
     }
     else
     {
         Status = AlarmStatus.Off;
     }
     Time          = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, hours, minutes, seconds);
     this.snooze   = snooze;
     this.Ringtone = ringtone;
 }
Exemple #26
0
 /// <summary>
 /// Update Fog Color
 /// </summary>
 void UpdateFogColour()
 {
     // Manage change in Fog Color tone
     if (fogToneDuration >= 1)
     {
         int  d      = fogToneDuration;
         Tone target = fogToneTarget;
         fogTone.Red      = (fogTone.Red * (d - 1) + target.Red) / d;
         fogTone.Green    = (fogTone.Green * (d - 1) + target.Green) / d;
         fogTone.Blue     = (fogTone.Blue * (d - 1) + target.Blue) / d;
         fogTone.Gray     = (fogTone.Gray * (d - 1) + target.Gray) / d;
         fogToneDuration -= 1;
     }
 }
            public override void Visit(ToneCommand visitee)
            {
                var stepTicks = CalcTicksFromLength(visitee.Length, this.ticksPerBar, this.length);
                var gateTicks = (int)(stepTicks * this.gateRatio);

                // TODO ちゃんと書き直す
                Data.ToneName toneName; switch (visitee.ToneName.BaseName.ToUpper())
                {
                case "C": toneName = Data.ToneName.C; break;

                case "D": toneName = Data.ToneName.D; break;

                case "E": toneName = Data.ToneName.E; break;

                case "F": toneName = Data.ToneName.F; break;

                case "G": toneName = Data.ToneName.G; break;

                case "A": toneName = Data.ToneName.A; break;

                case "B": toneName = Data.ToneName.B; break;

                default: throw new Exception();
                }

                var tone = new Tone {
                    Octave = this.octave, ToneName = toneName, Accidental = visitee.ToneName.Accidental
                };
                var freq = this.detune?.GetDetunedFreq(this.temperament[tone]) ?? this.temperament[tone];

                this.result.AddRange(this.owner.freqUsers.Select(u => new ValueInstruction <float>(u, freq)));
                if (!this.slur)
                {
                    this.result.AddRange(this.owner.noteUsers.Select(u => new NoteInstruction(u, true)));
                }
                this.result.Add(new WaitInstruction(gateTicks));

                if (!visitee.Slur)
                {
                    this.result.AddRange(this.owner.noteUsers.Select(u => new NoteInstruction(u, false)));
                }

                if (stepTicks - gateTicks > 0)
                {
                    this.result.Add(new WaitInstruction(stepTicks - gateTicks));
                }

                this.slur = visitee.Slur;
            }
Exemple #28
0
        public bool Equals(ForumRecruitmentDetail input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     TopicId == input.TopicId ||
                     (TopicId.Equals(input.TopicId))
                     ) &&
                 (
                     MicrophoneRequired == input.MicrophoneRequired ||
                     (MicrophoneRequired != null && MicrophoneRequired.Equals(input.MicrophoneRequired))
                 ) &&
                 (
                     Intensity == input.Intensity ||
                     (Intensity != null && Intensity.Equals(input.Intensity))
                 ) &&
                 (
                     Tone == input.Tone ||
                     (Tone != null && Tone.Equals(input.Tone))
                 ) &&
                 (
                     Approved == input.Approved ||
                     (Approved != null && Approved.Equals(input.Approved))
                 ) &&
                 (
                     ConversationId == input.ConversationId ||
                     (ConversationId.Equals(input.ConversationId))
                 ) &&
                 (
                     PlayerSlotsTotal == input.PlayerSlotsTotal ||
                     (PlayerSlotsTotal.Equals(input.PlayerSlotsTotal))
                 ) &&
                 (
                     PlayerSlotsRemaining == input.PlayerSlotsRemaining ||
                     (PlayerSlotsRemaining.Equals(input.PlayerSlotsRemaining))
                 ) &&
                 (
                     Fireteam == input.Fireteam ||
                     (Fireteam != null && Fireteam.SequenceEqual(input.Fireteam))
                 ) &&
                 (
                     KickedPlayerIds == input.KickedPlayerIds ||
                     (KickedPlayerIds != null && KickedPlayerIds.SequenceEqual(input.KickedPlayerIds))
                 ));
        }
Exemple #29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tone"></param>
        protected override void ApplyTone(TimbreBase timbre, Tone tone)
        {
            YM3812Timbre tim = (YM3812Timbre)timbre;

            bool native = false;

            if (tone.CNT == -1)
            {
                tim.ALG = (byte)tone.AL;
            }
            else
            {
                tim.ALG = (byte)tone.CNT;
                native  = true;
            }

            tim.FB = (byte)tone.FB;
            tim.GlobalSettings.Enable = false;
            tim.GlobalSettings.AMD    = null;
            tim.GlobalSettings.VIB    = null;

            for (int i = 0; i < 2; i++)
            {
                if (!native)
                {
                    tim.Ops[i].AR = (byte)(tone.aOp[i].AR / 2);
                    tim.Ops[i].DR = (byte)(tone.aOp[i].DR / 2);
                    tim.Ops[i].SR = (byte)(tone.aOp[i].SR / 2);
                    tim.Ops[i].TL = (byte)(tone.aOp[i].TL / 2);
                }
                else
                {
                    tim.Ops[i].AR = (byte)(tone.aOp[i].AR);
                    tim.Ops[i].DR = (byte)(tone.aOp[i].DR);
                    tim.Ops[i].SR = null;
                    tim.Ops[i].TL = (byte)(tone.aOp[i].TL);
                }
                tim.Ops[i].RR  = (byte)tone.aOp[i].RR;
                tim.Ops[i].SL  = (byte)tone.aOp[i].SL;
                tim.Ops[i].KSL = (byte)tone.aOp[i].KS;
                tim.Ops[i].KSR = 0;
                tim.Ops[i].MFM = (byte)tone.aOp[i].ML;
                tim.Ops[i].AM  = (byte)tone.aOp[i].AM;
                tim.Ops[i].VR  = 0;
                tim.Ops[i].EG  = 0;
                tim.Ops[i].WS  = 0;
            }
            timbre.TimbreName = tone.Name;
        }
Exemple #30
0
        public void SetToneRandomly_WithLimits(Random rng, Pleasantness p, EnergyLevel e)
        {
            if (rng == null)
            {
                rng = new Random();
            }

            var finalEnergy   = e == EnergyLevel.EitherLowOrHigh ? TheEnergyVariation : e;
            var finalStress   = p == Pleasantness.EitherPleasantOrNot ? TheStressVariation : p;
            var possibilities = IncidentEnumExtensions.GetPossibleTones(finalEnergy, finalStress);

            var diceRoll = rng.Next(0, possibilities.Count);

            theTone = possibilities[diceRoll];
        }
Exemple #31
0
        void Click_S5()
        {
            s5.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(() =>
                {
                    ISimpleAudioPlayer Tone;

                    Tone         = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
                    Stream Tonee = GetType().Assembly.GetManifestResourceStream("gTuner.sounds.30 A#3.mp3");
                    Tone.Load(Tonee);
                    Tone.Play();
                })
            });
        }
Exemple #32
0
        public void WithBaseToneTest(Tone tone, double duration)
        {
            ChordVariety acd = new ChordVariety(1, 4, 7);

            Orchestra         orc = new Orchestra(NSubstitute.Substitute.For <IMidiOut>());
            List <SingleBeat> v   = acd.WithBaseTone(Tone.CSharp, 5).GetChildren(orc.AddInstrument(InstrumentType.AccousticGrandPiano), 0).ToList();

            List <SingleBeat> comp = new List <SingleBeat>();

            comp.AddRange(new Keystroke(tone, duration).GetChildren(orc.AddInstrument(InstrumentType.AccousticGrandPiano), 0).ToList());
            comp.AddRange(new Keystroke(Tone.E, duration).GetChildren(orc.AddInstrument(InstrumentType.AccousticGrandPiano), 0).ToList());
            comp.AddRange(new Keystroke(Tone.G, duration).GetChildren(orc.AddInstrument(InstrumentType.AccousticGrandPiano), 0).ToList());

            CollectionAssert.AreEqual(comp, v);
        }
        public static bool IsPleasant(this Tone me)
        {
            switch (me)
            {
            case Tone.Calm:
            case Tone.Empathy:
            case Tone.Curiousity:
            case Tone.Joy:
            case Tone.Confidence:
                return(true);

            default:
                return(false);
            }
        }
Exemple #34
0
        /// <summary>
        /// Converts the MIDI Gremlin tone to the pitch that the MIDI standard specifies.
        /// </summary>
        internal int MidiPitchFromTone(Tone tone, int octave)
        {
            int pitch = (int)tone + //Tone enum is a value between 1 and 12, where C is the first tone.
                        (
                octave + 5 +        //Pitch 0 has octave -5, so octave 0 starts at 5*12=60.
                OctaveOffset        //Apply OctaveOffset of the keystroke's tone.
                        ) * 12;     //1 octave is 12 tone steps.

            if (0 > pitch || pitch > 127)
            {
                throw new ToneOutOfRangeException(pitch);
            }

            return(pitch);
        }
 private int StepsToA4( Octave octave, Tone note, Accidental accidental)
 {
     int stepsToOctave4 = (int)octave * 12;
     var stepsToA = (int)note;
     switch (accidental)
     {
         case Accidental.Flat:
             stepsToA--;
             break;
         case Accidental.Sharp:
             stepsToA++;
             break;
     }
     return stepsToOctave4 + stepsToA;
 }
Exemple #36
0
        private void PlayToneLocal(Tone t)
        {
            Stopwatch youarebeingwatched = new Stopwatch();
            var       sleeptimeafter     = TimeSpan.FromMilliseconds(t.duration * 0.3);

            youarebeingwatched.Start();
            Console.WriteLine($"Playing delaying tone forbefore playing tone for {t.duration} ms. Will sleep for {t.frequency} ms. after {sleeptimeafter.TotalMilliseconds} sleep ms");
            if (t.frequency > 0)
            {
                while (youarebeingwatched.ElapsedMilliseconds < t.duration)
                {
                    Thread.Sleep(t.frequency);
                }
            }
            Thread.Sleep(sleeptimeafter);
        }
 private static void generateXBlock(string toneKey, Stream outXblock, Tone.Tone tone)
 {
     var game = new GameXblock<Entity>();
     var entity = new Entity
     {
         Name = String.Format("GRTonePreset_{0}", toneKey),
         Iterations = 1,
         ModelName = "GRTonePreset",
         Id = tone.PersistentID.ToLower()
     };
     var properties = entity.Properties = new List<Property>();
     var addProperty = new Action<string, object>((a, b) => properties.Add(CreateProperty(a, b.ToString())));
     addProperty("Key", tone.Key);
     addProperty("Name", tone.Name);
     game.EntitySet = new List<Entity> {entity};
     game.Serialize(outXblock);
 }
Exemple #38
0
    public static void Main()
    {
        rand = new Random();
        var schoenOp25 = new Tone[] { Tone.E, Tone.F, Tone.G, Tone.Db, Tone.Gb, Tone.Eb, Tone.Ab, Tone.D, Tone.B, Tone.C, Tone.A, Tone.Bb };

        Matrix m = new Matrix(schoenOp25);

        Console.WriteLine(m);
        Console.WriteLine("");

        PlaySonata(m);

        Console.WriteLine("");
        Console.WriteLine("Finé");

        Console.ReadLine();
    }
Exemple #39
0
 public Call(	String name, Activity activity, CallType type, Tone tone,
     String duration, String encoder, String decoder, long bytesSent,
     long bytesReceived, long packetLoss, long packetError, long jitter,
     long decodeLatency, long roundTripDelay)
 {
     mName = name;
     mActivity = activity;
     mType = type;
     mTone = tone;
     mDuration = duration;
     mEncoder = encoder;
     mDecoder = decoder;
     mBytesSent = bytesSent;
     mBytesReceived = bytesReceived;
     mPacketLoss = packetLoss;
     mPacketError = packetError;
     mJitter = jitter;
     mDecodeLatency = decodeLatency;
     mRoundTripDelay = roundTripDelay;
 }
        private static void GenerateTonePsarc(Stream output, string toneKey, Tone.Tone tone)
        {
            var tonePsarc = new PSARC.PSARC();

            using (var packageIdStream = new MemoryStream())
            using (var toneManifestStream = new MemoryStream())
            using (var toneXblockStream = new MemoryStream())
            using (var toneAggregateGraphStream = new MemoryStream())
            {
                ToneGenerator.Generate(toneKey, tone, toneManifestStream, toneXblockStream, toneAggregateGraphStream);
                GenerateTonePackageId(packageIdStream, toneKey);
                tonePsarc.AddEntry(String.Format("Exports/Pedals/DLC_Tone_{0}.xblock", toneKey), toneXblockStream);
                var x = (from pedal in tone.PedalList
                         where pedal.Value.PedalKey.ToLower().Contains("bass")
                         select pedal).Count();
                tonePsarc.AddEntry(x > 0 ? "Manifests/tone_bass.manifest.json" : "Manifests/tone.manifest.json", toneManifestStream);
                tonePsarc.AddEntry("AggregateGraph.nt", toneAggregateGraphStream);
                tonePsarc.AddEntry("PACKAGE_ID", packageIdStream);
                tonePsarc.Write(output);
                output.Flush();
                output.Seek(0, SeekOrigin.Begin);
            }
        }
Exemple #41
0
 public MusicObject WithBaseTone(Tone tone)
 {
     return new ChordInstance();
 }
 public Note(Tone tone, params MelodyExpression[] children)
     : base(children)
 {
     m_Tone = tone;
 }
 // Sets tone display mode by enum
 public HanyuPinyin SetMode(Tone mode)
 {
     this.mode = mode;
     Convert();
     return this;
 }
Exemple #44
0
 public void Play(Tone tone, int duration, int velocity = 64)
 {
     throw new NotImplementedException();
 }
Exemple #45
0
 public Note(Tone frequency, Duration time)
 {
     _toneVal = frequency;
     _durVal = time;
 }
 // Sets tone display mode by integer
 public HanyuPinyin SetMode(int mode)
 {
     this.mode = (Tone)mode;
     Convert();
     return this;
 }
 // Builds this object with an input string and tone mode type Tone
 public HanyuPinyin(String str, Tone mode)
 {
     Init();
     SetMode(mode);
     SetInput(str);
 }
Exemple #48
0
	void OnTriggerEnter2D(Collider2D other) {
		if(other.gameObject.layer == (int)LayerID.Tone && other.gameObject == Tone)
		{
			toneSource = other.gameObject.GetComponent<AudioSource>();
			toneSource.volume = 1.0f;
			tone = other.gameObject.GetComponent<Tone>();
			toneGenerator = other.gameObject.GetComponent<ToneGenerator>();
			toneGenerator.SetFrequency(Frequency);
			toneGenerator.Type = Signale;
		}
	}
Exemple #49
0
	void OnTriggerExit2D(Collider2D other) {
		if(other.gameObject.layer == (int)LayerID.Tone && other.gameObject == Tone)
		{
			//toneSource.Stop();
			toneSource.volume = 1.0f;
			toneGenerator.SetFrequency(Game.DefaultFrequence);
			toneGenerator.Type = Game.DefaultSignal;
			tone = null;
			toneSource = null;
			toneGenerator = null;


		}
	}
Exemple #50
0
		private void WriteWavBeep(Tone tone, MemoryStream ms)
		{
			// Adapted from http://tech.reboot.pro/showthread.php?tid=2866

			// Sanity checks.
			if (tone.Volume > 1 || tone.Volume < 0)
			{
				throw new ArgumentOutOfRangeException("tone.Volume", "tone volume must be between 0 and 1.");
			}
			else if (tone.Frequency < 0)
			{
				throw new ArgumentOutOfRangeException("freq", "frequency should be 0 or more.");
			}

			// Computes intermediate values.
			int smp = Convert.ToInt32(WAV_FREQ * tone.Duration.TotalMilliseconds / 1000); // Amount of samples.
			int amp = Convert.ToInt32(MAX_AMPLITUDE * tone.Volume); // Amplitude

			// Writes each sample.
			for (int i = 0; i < smp; i++)
			{
				Int16 s = Convert.ToInt16(((amp * TWO_15_1000) - 1) * Math.Sin((2 * Math.PI * tone.Frequency / WAV_FREQ) * i));
				WriteShort(ms, s);
				WriteShort(ms, s); // We write it twice (stereo?).
			}
		}
Exemple #51
0
        public static double judge(string inputText)
        {
            List<emotion> emotions = getToneAnalysis("text", inputText);

            emotion cheer = emotions[0];
            emotion neg = emotions[1];
            emotion anger = emotions[2];

            Tone tone = new Tone(
                cheer.word_count*cheer.normalize_score + cheer.raw_score,
                neg.word_count*neg.normalize_score + neg.raw_score,
                anger.word_count*anger.normalize_score + anger.raw_score
            );

            double distFromPrimePositive = tone.findDistanceFrom(_primaryPositive);
            double distFromSecondaryPositive = tone.findDistanceFrom(_secondaryPositive);
            double distFromPrimeNegative = tone.findDistanceFrom(_primaryNegative);
            double distFromSecondaryNegative = tone.findDistanceFrom(_secondaryNegative);

            double percentage = (5*distFromPrimePositive + distFromSecondaryPositive)/(5 * distFromPrimePositive
                + distFromSecondaryPositive + 5 * distFromPrimeNegative + distFromSecondaryNegative);

            percentage = 1 - percentage;
            return percentage;
        }
Exemple #52
0
    private static void PlayTones(Tone[] tones, int quarterNoteLength)
    {
        notesPlayed.Add(new List<Note>());

        foreach (var t in tones.Select((tone, idx) => new { tone, idx }))
        {
            Console.Write(t.tone.ToString());
            if(t.idx == 11)
            {
                Console.WriteLine("");
            }
            else
            {
                Console.Write(",");
            }

            Tone tone = t.tone;
            int length = rand.Next(1, 5) * quarterNoteLength;
            notesPlayed.Last().Add(new Note(tone, length));

            PlayNote(notesPlayed.Last().Last());
        }
    }
Exemple #53
0
            public double findDistanceFrom(Tone tone)
            {
                double deltaX, deltaY, deltaZ;

                deltaX = this._cheerfulness - tone.Cheerfulness;
                deltaY = this._negative - tone.Negative;
                deltaZ = this._anger - tone.Anger;

                return Math.Sqrt(Math.Pow(deltaX, 2) + Math.Pow(deltaY, 2) + Math.Pow(deltaZ, 2));
            }
Exemple #54
0
 public Note (Tone tone, int duration, int velocity = 64)    //TODO: Make ctor that takes only offset
 {
     throw new NotImplementedException();
 }
Exemple #55
0
 // Define a constructor to create a specific note.
 public Note(Tone frequency, Duration time)
 {
     NoteTone = frequency;
     NoteDuration = time;
 }