コード例 #1
0
ファイル: Aggregator.cs プロジェクト: hypesystem/MDMI-F2014
 public static SectionStats AggregateSections(IEnumerable<Section> sections)
 {
     var enumerable = sections as Section[] ?? sections.ToArray();
     var confidenceMean = enumerable.Average(s => s.Confidence);
     var duration = Aggregate(enumerable.Select(s => s.Duration));
     var result = new SectionStats(confidenceMean, duration,enumerable.Count());
     return result;
 }
コード例 #2
0
ファイル: LRNReader.cs プロジェクト: hypesystem/MDMI-F2014
        Song ParseRow(string row_data)
        {
            var song_builder = new SongBuilder();
            string[] fields = row_data.Split('\t');

            //0 -> id; ignore
            int ptr = 1;
            //Segment stats
            //1-8 -> LoudnessStart
            var loudness_start = ReadAggregate(fields, ref ptr);
            //9-16 -> LoudnessMax
            var loudness_max = ReadAggregate(fields, ref ptr);
            //17-24 -> LoudnessMaxTime
            var loudness_max_time = ReadAggregate(fields, ref ptr);
            //25-32 -> Duration
            var seg_duration = ReadAggregate(fields, ref ptr);
            //Segment stats: Pitches
            var pitches = ReadAggregates(fields, ref ptr, 12);
            //Segment stats: Timbre
            var timbre = ReadAggregates(fields, ref ptr, 12);
            var segment_stats = new SegmentStats(0d, loudness_start, loudness_max_time, loudness_max, seg_duration, pitches, timbre);
            //Sections stats
            //?? -> Count
            var sec_count = ReadIntField(fields, ref ptr);
            //??+7 -> Duration
            var sec_duration = ReadAggregate(fields, ref ptr);
            var sections_stats = new SectionStats(0d, sec_duration, sec_count);

            //Single attrs
            //?? -> ArtistLatitude
            var artist_latitude = ReadDoubleField(fields, ref ptr);
            //?? -> ArtistLongitude
            var artist_longitude = ReadDoubleField(fields, ref ptr);
            //?? -> Danceability
            var danceability = ReadDoubleField(fields, ref ptr);
            //?? -> Duration
            var duration = ReadDoubleField(fields, ref ptr);
            //?? -> Energy
            var energy = ReadDoubleField(fields, ref ptr);
            //?? -> Tempo
            var tempo = ReadDoubleField(fields, ref ptr);
            //?? -> ArtistName
            var artist_name = ReadField(fields, ref ptr);
            //?? -> Genre
            var genre = ReadField(fields, ref ptr);
            //?? -> TrackName
            var track_name = ReadField(fields, ref ptr);

            return new Song(artist_name, track_name, segment_stats, sections_stats, 0d, 0d, artist_longitude, artist_latitude, danceability, duration, energy, tempo, Key.AflatMaj, new TimeSignature(), genre);
        }
コード例 #3
0
ファイル: Song.cs プロジェクト: hypesystem/MDMI-F2014
 public Song(string artistName, string trackName, SegmentStats segmentStats, SectionStats sectionsStats, 
     double familiarity, double hotttnesss, double artistLongtitude, double artistLatitude,
     double danceability, double duration, double energy, double tempo, Key key, TimeSignature timeSignature, String genre = null)
 {
     ArtistName = artistName;
     TrackName = trackName;
     SegmentStats = segmentStats;
     SectionsStats = sectionsStats;
     Familiarity = familiarity;
     Hotttnesss = hotttnesss;
     ArtistLongtitude = artistLongtitude;
     ArtistLatitude = artistLatitude;
     Danceability = danceability;
     Duration = duration;
     Energy = energy;
     Tempo = tempo;
     Key = key;
     TimeSignature = timeSignature;
     Genre = genre;
 }