Commit 7344a4b5 authored by LiniEisha's avatar LiniEisha

audio recorder

parent b747cd2a
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
<div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordionSidebar"> <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordionSidebar">
<div class="bg-white py-2 collapse-inner rounded"> <div class="bg-white py-2 collapse-inner rounded">
<h6 class="collapse-header">Components:</h6> <h6 class="collapse-header">Components:</h6>
<a class="collapse-item" href="/summary/record">Record Lecture</a>
<a class="collapse-item" href="/summary/lecture">Summarization</a> <a class="collapse-item" href="/summary/lecture">Summarization</a>
</div> </div>
</div> </div>
......
import sounddevice as sd
from scipy.io.wavfile import write
import wavio as wv
# Sampling frequency
freq = 44100
# Recording duration
duration = 10
# Start recorder with the given values of
# duration and sample frequency
recording = sd.rec(int(duration * freq),
samplerate=freq, channels=2)
# Record audio for the given number of seconds
sd.wait()
# This will convert the NumPy array to an audio
# file with the given sampling frequency
write("recording0.wav", freq, recording)
#Convert the NumPy array to audio file
wv.write("recording1.wav", recording, freq, sampwidth=2)
\ No newline at end of file
...@@ -54,3 +54,4 @@ class LectureNotices (models.Model): ...@@ -54,3 +54,4 @@ class LectureNotices (models.Model):
def __str__(self): def __str__(self):
return self.lecture_notice_id return self.lecture_notice_id
{% extends 'FirstApp/template.html' %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Lecture Recording</title>
</head>
<body>
% block javascript %}
{% load static %}
<!-- Bootstrap core JavaScript-->
<script src="{% static 'FirstApp/vendor/jquery/jquery.min.js' %}"></script>
<script src="{% static 'FirstApp/vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>
<!-- Page level plugins -->
<script src="{% static 'FirstApp/vendor/datatables/jquery.dataTables.min.js' %}"></script>
<script src="{% static 'FirstApp/vendor/datatables/dataTables.bootstrap4.min.js' %}"></script>
<!-- Page level custom scripts -->
<script src="{% static 'FirstApp/js/demo/datatables-demo.js' %}"></script>
<!-- Core plugin JavaScript-->
<script src="{% static 'FirstApp/vendor/jquery-easing/jquery.easing.min.js' %}"></script>
<!-- Load TensorFlow.js -->
<script src="https://unpkg.com/@tensorflow/tfjs"></script>
<!-- Load Posenet -->
<script src="https://unpkg.com/@tensorflow-models/posenet">
</script>
{% endblock %}
<div id="wrapper">
<div id="content-wrapper" class="d-flex flex-column">
<div id="content">
{% block 'container-fluid' %}
<div class="container-fluid">
{% load static %}
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800">Lecture Record</h1>
</div>
<div>
<button TYPE="button" class="btn btn-success audio_process">Start Recording</button>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
...@@ -8,6 +8,7 @@ router = routers.DefaultRouter() ...@@ -8,6 +8,7 @@ router = routers.DefaultRouter()
urlpatterns = [ urlpatterns = [
path('lecture', views.summarization), path('lecture', views.summarization),
path('record', views.lectureRecord),
# API to retrieve lecture summarizing details # API to retrieve lecture summarizing details
......
...@@ -6,6 +6,14 @@ from .models import LectureAudio, LectureAudioNoiseRemoved, LectureSpeechToText, ...@@ -6,6 +6,14 @@ from .models import LectureAudio, LectureAudioNoiseRemoved, LectureSpeechToText,
from .serializer import LectureAudioSerializer, LectureAudioNoiseRemovedSerializer, LectureAudioSummarySerializer, \ from .serializer import LectureAudioSerializer, LectureAudioNoiseRemovedSerializer, LectureAudioSummarySerializer, \
LectureSpeechToTextSerializer, LectureNoticesSerializer LectureSpeechToTextSerializer, LectureNoticesSerializer
def lectureRecord(request):
lecture_audio = LectureAudio.objects.all()
lecture_audio_ser = LectureAudioSerializer(lecture_audio, many=True)
print('lecture record data: ', lecture_audio_ser.data)
return render(request, "LectureSummarizationApp/RecordLecture.html")
# Views used in Lecture Summarization # Views used in Lecture Summarization
...@@ -108,4 +116,5 @@ class lectureSummaryList(APIView): ...@@ -108,4 +116,5 @@ class lectureSummaryList(APIView):
lecture_audio_id=request.data["lecture_audio_id"], lecture_audio_id=request.data["lecture_audio_id"],
notice_text=request.data["notice_text"] notice_text=request.data["notice_text"]
).save() ).save()
return Response({"response": request.data}) return Response({"response": request.data})
\ No newline at end of file
...@@ -24,5 +24,6 @@ urlpatterns = [ ...@@ -24,5 +24,6 @@ urlpatterns = [
path('attendance/', include('AttendanceApp.urls')), path('attendance/', include('AttendanceApp.urls')),
path('lecturer/', include('MonitorLecturerApp.urls')), path('lecturer/', include('MonitorLecturerApp.urls')),
# path('lecturer/', include('MonitorLecturerApp.urls')), # path('lecturer/', include('MonitorLecturerApp.urls')),
path('summary/', include('LectureSummarizingApp.urls')) path('summary/', include('LectureSummarizingApp.urls')),
path('record/', include('LectureSummarizingApp.urls'))
] ]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment